package com.gaohe.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gaohe.common.Result;
import com.gaohe.mapper.StadiumMapper;
import com.gaohe.pojo.Stadium;
import com.gaohe.service.StadiumService;
import org.springframework.stereotype.Service;

@Service
public class StadiumServiceImpl extends ServiceImpl<StadiumMapper, Stadium> implements StadiumService {
    /**
     * 根据商户ID获取默认场馆信息
     *
     * @param shopkeeperId 商户ID
     * @return 返回默认场馆信息的结果对象
     */
    @Override
    public Result getDefaultStadiumByShopkeeperId(Long shopkeeperId) {
        LambdaQueryWrapper<Stadium> qw = new LambdaQueryWrapper<>();
        // 查询条件：指定商户ID且为默认场馆
        qw.eq(Stadium::getShopkeeperId, shopkeeperId)
                .eq(Stadium::getIsDefault, 0);
        Stadium stadium = this.getOne(qw);
        return Result.success(stadium);
    }

}
